package com.dragon.modules.yuegou.query.system;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dragon.modules.yuegou.entity.system.DataAccessEntity;
import com.dragon.modules.yuegou.enums.system.DataAccessOwnerType;
import com.dragon.modules.yuegou.mybatis.Condition;
import com.dragon.modules.yuegou.mybatis.Query;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonUnwrapped;

import java.time.LocalDateTime;

/**
 * 数据权限 动态查询条件
 * 
 * @author pbuilder generated
 * @date 2019-03-15 15:37:59
 * @version 2.0
 */
@JsonInclude(Include.NON_NULL)
public class DataAccessQuery extends DataAccessEntity implements Query<DataAccessEntity> {

	private static final long serialVersionUID = 1L;


    /** 查询条件 */
	@JsonUnwrapped(prefix = "id")
	private Condition<String> idCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "userId")
	private Condition<String> userIdCondition;

    /** [枚举]角色类型：0-平台-PLATFORM、1-集团-GROUP、2-商圈-BUSINESS_DISTRICT查询条件 */
	@JsonUnwrapped(prefix = "ownerType")
	private Condition<DataAccessOwnerType> ownerTypeCondition;

    /** 商圈id查询条件 */
	@JsonUnwrapped(prefix = "busdId")
	private Condition<String> busdIdCondition;

    /** 集团id查询条件 */
	@JsonUnwrapped(prefix = "groupId")
	private Condition<String> groupIdCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "createdTime")
	private Condition<LocalDateTime> createdTimeCondition;

    /** 查询条件 */
	@JsonUnwrapped(prefix = "createdBy")
	private Condition<String> createdByCondition;

	/**
	 * 构造一个查询条件对象
	 */
	public DataAccessQuery() {
		super();
	}

	/**
	 * 依据实体对象构造一个查询条件对象
	 * 
	 * @param entity 实体对象
	 */
	public DataAccessQuery(DataAccessEntity entity) {
		super(entity);
	}

	/**
	 * 依据其它查询条件对象的信息构造一个查询条件对象
	 * 
	 * @param other 查询条件对象
	 */
	public DataAccessQuery(DataAccessQuery other) {
		super(other);
		if(other.idCondition != null) {
			this.idCondition = other.idCondition.copy();
		}
		if(other.userIdCondition != null) {
			this.userIdCondition = other.userIdCondition.copy();
		}
		if(other.ownerTypeCondition != null) {
			this.ownerTypeCondition = other.ownerTypeCondition.copy();
		}
		if(other.busdIdCondition != null) {
			this.busdIdCondition = other.busdIdCondition.copy();
		}
		if(other.groupIdCondition != null) {
			this.groupIdCondition = other.groupIdCondition.copy();
		}
		if(other.createdTimeCondition != null) {
			this.createdTimeCondition = other.createdTimeCondition.copy();
		}
		if(other.createdByCondition != null) {
			this.createdByCondition = other.createdByCondition.copy();
		}
	}

	@Override
	public QueryWrapper<DataAccessEntity> toQueryWrapper() {
		QueryWrapper<DataAccessEntity> wrapper = new QueryWrapper<>(this);
		if (idCondition != null) {
			idCondition.toWrapper(wrapper, COL_ID);
		}
		if (userIdCondition != null) {
			userIdCondition.toWrapper(wrapper, COL_USER_ID);
		}
		if (ownerTypeCondition != null) {
			ownerTypeCondition.toWrapper(wrapper, COL_OWNER_TYPE);
		}
		if (busdIdCondition != null) {
			busdIdCondition.toWrapper(wrapper, COL_BUSD_ID);
		}
		if (groupIdCondition != null) {
			groupIdCondition.toWrapper(wrapper, COL_GROUP_ID);
		}
		if (createdTimeCondition != null) {
			createdTimeCondition.toWrapper(wrapper, COL_CREATED_TIME);
		}
		if (createdByCondition != null) {
			createdByCondition.toWrapper(wrapper, COL_CREATED_BY);
		}
		return wrapper;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> id() {
		this.idCondition = new Condition<>();
		return this.idCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return idCondition 查询条件
	 */
	public Condition<String> getIdCondition() {
		return idCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param idCondition 查询条件
	 */
	public void setIdCondition(Condition<String> idCondition) {
		this.idCondition = idCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return userIdCondition 查询条件
	 */
	public Condition<String> userId() {
		this.userIdCondition = new Condition<>();
		return this.userIdCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return userIdCondition 查询条件
	 */
	public Condition<String> getUserIdCondition() {
		return userIdCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param userIdCondition 查询条件
	 */
	public void setUserIdCondition(Condition<String> userIdCondition) {
		this.userIdCondition = userIdCondition;
	}

	/**
	 * 构造并返回[枚举]角色类型：0-平台-PLATFORM、1-集团-GROUP、2-商圈-BUSINESS_DISTRICT查询条件
	 * 
	 * @return ownerTypeCondition [枚举]角色类型：0-平台-PLATFORM、1-集团-GROUP、2-商圈-BUSINESS_DISTRICT查询条件
	 */
	public Condition<DataAccessOwnerType> ownerType() {
		this.ownerTypeCondition = new Condition<>();
		return this.ownerTypeCondition;
	}
	
	/**
	 * 获取[枚举]角色类型：0-平台-PLATFORM、1-集团-GROUP、2-商圈-BUSINESS_DISTRICT查询条件
	 * 
	 * @return ownerTypeCondition [枚举]角色类型：0-平台-PLATFORM、1-集团-GROUP、2-商圈-BUSINESS_DISTRICT查询条件
	 */
	public Condition<DataAccessOwnerType> getOwnerTypeCondition() {
		return ownerTypeCondition;
	}

	/**
	 * 设置[枚举]角色类型：0-平台-PLATFORM、1-集团-GROUP、2-商圈-BUSINESS_DISTRICT查询条件
	 * 
	 * @param ownerTypeCondition [枚举]角色类型：0-平台-PLATFORM、1-集团-GROUP、2-商圈-BUSINESS_DISTRICT查询条件
	 */
	public void setOwnerTypeCondition(Condition<DataAccessOwnerType> ownerTypeCondition) {
		this.ownerTypeCondition = ownerTypeCondition;
	}

	/**
	 * 构造并返回商圈id查询条件
	 * 
	 * @return busdIdCondition 商圈id查询条件
	 */
	public Condition<String> busdId() {
		this.busdIdCondition = new Condition<>();
		return this.busdIdCondition;
	}
	
	/**
	 * 获取商圈id查询条件
	 * 
	 * @return busdIdCondition 商圈id查询条件
	 */
	public Condition<String> getBusdIdCondition() {
		return busdIdCondition;
	}

	/**
	 * 设置商圈id查询条件
	 * 
	 * @param busdIdCondition 商圈id查询条件
	 */
	public void setBusdIdCondition(Condition<String> busdIdCondition) {
		this.busdIdCondition = busdIdCondition;
	}

	/**
	 * 构造并返回集团id查询条件
	 * 
	 * @return groupIdCondition 集团id查询条件
	 */
	public Condition<String> groupId() {
		this.groupIdCondition = new Condition<>();
		return this.groupIdCondition;
	}
	
	/**
	 * 获取集团id查询条件
	 * 
	 * @return groupIdCondition 集团id查询条件
	 */
	public Condition<String> getGroupIdCondition() {
		return groupIdCondition;
	}

	/**
	 * 设置集团id查询条件
	 * 
	 * @param groupIdCondition 集团id查询条件
	 */
	public void setGroupIdCondition(Condition<String> groupIdCondition) {
		this.groupIdCondition = groupIdCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return createdTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> createdTime() {
		this.createdTimeCondition = new Condition<>();
		return this.createdTimeCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return createdTimeCondition 查询条件
	 */
	public Condition<LocalDateTime> getCreatedTimeCondition() {
		return createdTimeCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param createdTimeCondition 查询条件
	 */
	public void setCreatedTimeCondition(Condition<LocalDateTime> createdTimeCondition) {
		this.createdTimeCondition = createdTimeCondition;
	}

	/**
	 * 构造并返回查询条件
	 * 
	 * @return createdByCondition 查询条件
	 */
	public Condition<String> createdBy() {
		this.createdByCondition = new Condition<>();
		return this.createdByCondition;
	}
	
	/**
	 * 获取查询条件
	 * 
	 * @return createdByCondition 查询条件
	 */
	public Condition<String> getCreatedByCondition() {
		return createdByCondition;
	}

	/**
	 * 设置查询条件
	 * 
	 * @param createdByCondition 查询条件
	 */
	public void setCreatedByCondition(Condition<String> createdByCondition) {
		this.createdByCondition = createdByCondition;
	}

}
